package own.stu.jobgib.playown.netty.teston;

import own.stu.jobgib.playown.netty.teston.httpClient.AsyncHttpHelper;
import org.asynchttpclient.Request;
import org.asynchttpclient.RequestBuilder;
import org.asynchttpclient.Response;

import java.util.concurrent.CompletableFuture;

public class HttpClientTest {

    public static void main(String[] args) {
        RequestBuilder builder = new RequestBuilder();
        Request request = builder.setUrl("https://www.baidu.com")
                .setMethod("get")
                .build();
        CompletableFuture<Response> completableFuture = AsyncHttpHelper.getInstance().executeRequest(request);
        completableFuture.thenAccept(res -> {
            System.out.println(res.getResponseBody());
        });
    }
}
